import { adminRoute } from "@/router/admin.ts";

export const constantRoute = [
  // 根路径重定向到登录页
  {
    path: '/',
    redirect: '/login'
  },
  //配置路由页面
  {
    path: '/login',
    component: () => import('@/views/login/index.vue'),
    name: 'login',//路由名称
    meta: {
      title: '登录',
      hidden: true //路由标题是否隐藏
    }
  },
  {
    path: '/404',
    component: () => import('@/views/404/index.vue'),
    name: '404',//路由名称
    meta: {
      title: '404',
      hidden: true //路由标题是否隐藏
    }
  },
  {
    path: '/register',
    component: () => import('@/views/login/Register.vue'),
    name: 'register',
    meta: {
      title: '注册',
      hidden: true
    }
  },
  {
    path: '/forget',
    component: () => import('@/views/login/Forget.vue'),
    name: 'forget',
    meta: {
      title: '忘记密码',
      hidden: true
    }
  },
  // 使用展开运算符添加管理员一级菜单路由
  ...(Array.isArray(adminRoute) ? adminRoute : [adminRoute])
];